/* tslint:disable:no-console */
import React, {FC, useEffect, useState} from 'react';
import {Text, View} from 'react-native';
import {Tabs} from '@ant-design/react-native';
import axios from '../../../http/http';
import useStorage from '../../../hooks/storage';
import {TUserInfo} from '../../../type/TUser';
import Advice from './Advice';
import Collect from './Collect';
const Behavior = () => {
  const userInfoStorage = useStorage<TUserInfo>('userInfo');
  const [prodList, setProdList] = useState([]);
  const [messageList, setMessageList] = useState([]);
  const [remarkList, setRemarkList] = useState([]);
  const [recommentList, setRecommentList] = useState([]);

  useEffect(() => {
    getTraceData();
  }, []);
  const getTraceData = async () => {
    const userInfo = await userInfoStorage.getItem();
    axios
      .post('/trace/trace', {
        username: userInfo!.username,
      })
      .then(res => {
        if (res.error === -1) {
          console.log(res.data[2]);
          setProdList(res.data[0]);
          setMessageList(res.data[1]);
          setRemarkList(res.data[2]);
          setRecommentList(res.data[3]);
        }
      });
  };
  const tabs = [
    {title: '留言'},
    {title: '回复'},
    {title: '评论'},
    {title: '作品'},
  ];
  // const tabs = [
  //   {title: 'First Tab'},
  //   {title: 'Second Tab'},
  //   {title: 'Third Tab'},
  // ];
  const style = {paddingHorizontal: 6};
  return (
    <View style={{flex: 1}}>
      <Tabs
        tabs={tabs}
        tabBarActiveTextColor="red"
        tabBarInactiveTextColor="#000">
        <View style={style}>
          <Advice messageData={messageList} />
        </View>
        <View style={style}>
          <Text>Content of First Tab</Text>
        </View>
        <View style={style}>
          <Text>Content of Third Tab</Text>
        </View>
        <View style={style}>
          <Text>Content of Third Tab</Text>
        </View>
      </Tabs>
    </View>
  );
};
export default Behavior;
